package org.pie.drawing.apps.picimageserver.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.pie.drawing.apps.picimageserver.dto.ImageInfoDto;
import org.pie.drawing.apps.picimageserver.service.ImageIndexService;
import org.pie.drawing.apps.picimageserver.utils.R;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "图片保存")
@CrossOrigin
@RestController
@RequestMapping(value = "image")
public class ImageSaveController {

    private final ImageIndexService imageIndexService;

    @ApiOperation("保存图片信息")
    @PostMapping(value = "save")
    public R save(@ModelAttribute ImageInfoDto dto) {
        imageIndexService.saveImageIndex(dto);
        return R.ok();
    }
}
